package tudolist.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.jgenesis.bean.BasicBean;

@Entity
@Table(name="task_lists")
@SequenceGenerator(name="SEQUENCE", sequenceName="task_lists_id_seq")
public class TaskList extends BasicBean {

	private static final long serialVersionUID = 3062332143256863751L;

	public static enum Visibility {
		Private, Public
	}
	
	@ManyToOne
	@JoinColumn(name="owner_id")
	private User owner;
	
	@Enumerated(EnumType.ORDINAL)
	private Visibility visibility;
	
	private String name;

	@Column(name="creation_date")
	private Date creationDate;
	
	@OneToMany
	@JoinColumn(name="list_id")
	private List<Task> tasks;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Task> getTasks() {
		return tasks;
	}

	public void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date createdAt) {
		this.creationDate = createdAt;
	}

	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	public Visibility getVisibility() {
		return visibility;
	}

	public void setVisibility(Visibility visibility) {
		this.visibility = visibility;
	}
	
}
